import 'package:flutter/material.dart';
import 'package:ytbusiness/utils/screen_adaptation.dart';

//车辆信息
class RepairCarInfo extends StatefulWidget {
  @override
  _RepairCarInfoState createState() => _RepairCarInfoState();
}

class _RepairCarInfoState extends State<RepairCarInfo> {
  List<String> _carInfo = [
    "车型识别码",
    "主机厂",
    "车辆型号",
    "销售名称",
    "年款",
    "变速箱",
    "前制动器类型",
    "后制动器类型",
    "发动机型号",
    "进气形式",
    "燃油类型",
    "厂商指导价格",
    "底盘号",
    "车辆类型",
    "轮胎规格"
  ]; //车辆信息
  List<String> _carContent = [
    "MIH011216A009",
    "本田(东风本田)",
    "哥瑞",
    "1.5 无级 经典版",
    "2016",
    "无级变速器(CVT)",
    "无级变速器(CVT)",
    "无级变速器(CVT)",
    "鼓式",
    "进气形式",
    "燃油类型",
    "厂商指导价格",
    "GJ6",
    "轿车",
    "前:185/60 R15 后:185/60 R15"
  ]; //
  @override
  Widget build(BuildContext context) {
    return ListView.builder(
        physics: NeverScrollableScrollPhysics(),
        shrinkWrap: true,
        itemCount: _carInfo.length,
        itemBuilder: (context, index) {
          return _orderInfo(title: _carInfo[index],
              content: _carContent[index]);
        });
  }

  //订单信息
  Widget _orderInfo({String title, String content}) {
    return Container(
      padding: EdgeInsets.only(top: setWidth(20)),
      height: setWidth(37),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.start,
        children: [
          Expanded(
            child: RichText(
                text: TextSpan(children: [
                  TextSpan(
                      text: "$title:",
                      style:
                      TextStyle(color: Color(0xff999999), fontSize: setSp(15))),
                  WidgetSpan(
                      child: SizedBox(
                        width: setWidth(3),
                      )),
                  TextSpan(
                      text: content,
                      style:
                      TextStyle(color: Color(0xff323232), fontSize: setSp(15))),
                ])),
          ),
        ],
      ),
    );
  }

  //订单状态
  Widget _orderState({String title, String content}) {
    return Container(
      margin: EdgeInsets.only(top: setWidth(17)),
      height: setWidth(18),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.start,
        children: [
          Expanded(
            child: RichText(
                text: TextSpan(children: [
                  TextSpan(
                      text: "$title:",
                      style:
                      TextStyle(color: Color(0xff999999), fontSize: setSp(15))),
                  WidgetSpan(
                      child: SizedBox(
                        width: setWidth(3),
                      )),
                  TextSpan(
                      text: content,
                      style:
                      TextStyle(color: Color(0xffFF4D4D), fontSize: setSp(15))),
                ])),
          ),
        ],
      ),
    );
  }
}
